package typechecker.ast;

import java.util.Stack;

import typechecker.TypeCheckingException;

public class Context<E> extends Stack<E>{
	private static final long serialVersionUID = -2669650310356577871L;
	
	public E lookup(String name){
		for(int i=size()-1; i>=0; i--){
			if( this.get(i).toString().equals(name)){
				return this.get(i);
			}
		}
		throw new TypeCheckingException("Free variable " + name );
	}
	
	
}
